Skip to content

Favorites: A–Z applies to the list, the guide order and the zap list - #85

Closed
Quad-Plex wants to merge 2 commits into
ahXN00:mainfrom
Quad-Plex:fix/favorites-alpha-sort
Closed

Quad-Plex wants to merge 2 commits into
ahXN00:mainfrom
Quad-Plex:fix/favorites-alpha-sort

Conversation

@Quad-Plex

@Quad-Plex Quad-Plex commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What

The A–Z sort chip never reached the Favorites queries. pagingFavoritesManual and snapshotFavoritesManual ordered by the user's moved position and then addedAt DESC, so with Favorites selected A–Z changed nothing while provider folders and All channels sorted properly.

  • Both queries take an alpha flag and sort by name when it is set; moved rows keep their saved place either way.
  • alpha is the last parameter and defaults to false, so every existing call site — the phone app's Move list and the More screen's favourites among them — compiles unchanged and keeps its order.
  • livePagingSource passes the chip for Live TV, and the Guide's order map and the in-player zap list pass the same flag, so CH+/CH− steps in the order the screen shows.
  • Equal names break by id, so a channel favorited from two playlists cannot make the paging source duplicate or skip a row between pages.
  • A–Z is case-insensitive. LOWER(name) in the favourites queries and every other A–Z query (All, provider folders, catch-up, custom categories, movies, series), with id as the final tie-break. SQLite's default BINARY collation sorted every lowercase name after every uppercase one, so a Favorites + A–Z list ended with arte and the other lowercase-initial channels below ZDFneo. A–Z is no longer index-served; the name composites still serve provider order, name lookups and tie-breaks.

Why

In Favorites the list stayed in the order the channels were favorited in — which reads as provider blocks when a whole playlist was favorited in one go, and it is the one list where duplicate names are common. Passing the flag exposed the collation bug: the sort chip was doing nothing, and once it did something it put arte at the bottom of the alphabet.

Testing

  • New instrumentation test in the TV app (ChannelDaoFavoritesOrderTest, next to the existing ChannelDaoBoundedWindowTest): A–Z mixes two playlists in name order, the default keeps most-recently-added first, moved rows keep their place in both sorts, and the paging and snapshot queries agree. A second test pins the reported case: arte sorts with the A's and ZDFneo stays last, in Favorites, All channels and a provider folder. The test source compiles against this branch (:app:compileStandardDebugAndroidTestKotlin); the rebuilt release was then verified on the TV end to end (below).
  • :core:testDebugUnitTest, lint and the i18n ratchet pass on this branch.
  • Exercised on a Chromecast with Google TV using a two-playlist (Zattoo + sat1) setup; rebuilt side-by-side release installed with adb install -r and the Guide verified with Favorites + A–Z.

Release note

📺 Favorites: A–Z sorts across every playlist, not the order the channels were added — and lowercase channel names no longer fall to the bottom

The companion TV-app PR is ahXN00/OwnTV#369 (draft until this is released and the app's owntvCore pin is bumped — it builds against core's source locally, so its CI is red until then).

Both Favorites queries ordered by the position the user moved a channel to,
then by `addedAt DESC`, and never read the sort chip. So with Favorites
selected, A–Z changed nothing: the list stayed in the order channels were
favorited in, which reads as provider blocks when a whole playlist was
favorited in one go, while provider folders and All channels sorted properly.

The two queries now take an `alpha` flag, the same way the folder and
custom-category ones already do, and sort by name when it is set. It comes
last and defaults to `false`, so every existing call site — the phone app's
Move list and the More screen's favourites among them — compiles and keeps
its order. The lists the chip governs pass it: `livePagingSource` for Live TV
and the Guide's order map, plus the in-player zap list, which otherwise
stepped in a different order than the screen showed. Move sessions follow the
visible order too.

Equal names break by `id`, so a channel favorited from two playlists cannot
make the paging source duplicate or skip a row between pages.
SQLite's default BINARY collation sorts every lowercase name after every
uppercase one, so a Favorites + A–Z list ended with "arte" and the other
lowercase-initial channels below "ZDFneo": the favorites queries added in
2ae3ad5 sorted by c.name, and so did the folder, All, catch-up, custom
category, movie and series A–Z queries.

Sort by LOWER(name) — the same rule the category rail and the Guide's
in-memory A–Z already use — and break ties by id so paging stays stable
when two names differ only in case.

A–Z is no longer index-served; the (sourceId, name)/(categoryId, name)
indexes still serve provider order, name lookups and tie-breaks. The
alternative, a NOCASE column or expression index, needs a schema
migration for a sort order.
ahXN00 added a commit that referenced this pull request Nov 18, 2026
…gs, fixed sort on Favorites/History

Merges #86 (TV Guide remembers its own category), with one fix on top:
SettingsBackupCoverageTest now lists last_guide_category among the keys
exported per profile in the lastCategories block, as it already did for
Live TV, Movies and Series. The key is in POSITIONS, so deleting a
profile forgets it through forgetProfilePositions.

Central Kurdish (ckb) added to tools/i18n/locales.json as a catalogue-only
language (tier 2, Arabic script, right to left, no resource directory),
following the Basque entry: plural rule one/other in validate_strings.py,
the expected catalogue-only tags and the canonical Weblate code;
test_i18n_tools.py and SupportedLocalesTest counts raised by one;
SupportedLocales.kt regenerated. The next translations sync opens the
promotion pull request. Closes #82

LiveKey.hasFixedOrder: Favorites and History are ordered by moved items,
then newest added / last watched, whatever the section's sort says. Both
apps use it to show the sort as a greyed "Newest first" there (existing
string content_newest_first). The A-Z part of #85 (case-insensitive
sorting) is rebuilt separately; this is the Favorites/History rule from
#85 / ahXN00/OwnTV#369, rebuilt rather than merged.

Phone player screen lock: player_lock_screen and player_hold_to_unlock in
strings_player.xml, base plus every packaged locale.

Verified: ./gradlew build (core and player-core unit tests, lint,
instrumentation APK compile); the four i18n gates, check_weblate_format,
test_i18n_tools.py (132 OK). Both apps built against this source and
tested on a TCL TV and an OnePlus phone (release builds over the existing
install, data kept).
ahXN00 added a commit to ahXN00/OwnTV that referenced this pull request Nov 18, 2026
… lists, stepper taps, Sports header, fixed sort on Favorites/History

Merges #370 (TV Guide: keep the category you left, and keep its list
while you watch). EpgViewModel splits a picked category (saved per
profile through core's LAST_GUIDE_CATEGORY) from one the app places;
LiveViewModel.watchFromGuide arms the Guide's visible rows as the zap
list; startup modes keep the remembered category when it holds the
channel.

Steppers: StageStepper takes the row's onStep, so a touch or air-mouse
tap on "-" lowers and on "+" raises. The buttons take no focus (the
D-pad still treats the row as one control) and consume the tap, so the
row's own click, which steps up, no longer fires instead. A disabled row
ignores them. Fixes the setup wizard's zoom and text size, Glass, Sports
and Settings rows. Fixes #359

CH+/CH- page the programme page (ProgrammeDayPage, index-based, jumps
scroll instantly) and the Live TV catch-up list (CatchupDialog: the row
jumped to takes the focus requester), with the user's skip counts and
long-press to the ends, as every other list. Fixes #373

Sports: the continue pill (last channel / resume) is not drawn on the
Sports section, whose header runs to the top right, and is capped at
300 px elsewhere; a long name in a long language covered the tabs.

Favorites and History: their order is their own (moved items, then
newest first), so the sort tool reads a greyed "Newest first" there and
the D-pad skips it (StageTool enabled = false; VodFixedSortTool for the
Movies/Series layouts). The stored sort is untouched and applies to every
other list. Favorites and History sort rule, rebuilt from
ahXN00/OwnTV_Core#85 / #369.

Docs: CHANGELOG, USER_GUIDE (CH+/CH- lists, Guide memory, fixed sort),
product brief.

Verified: assembleStandardRelease and lintStandardDebug (0 errors), i18n
literal and overflow checks. On the TCL TV (release build installed over
the existing app, data kept): no pill on Sports; History sort dim and
skipped; CH- / CH+ page the programme page and the catch-up list; "-"
and "+" by touch on Popup size; the Guide reopened on its own category
after a force-stop; CH+ after a pick in a two-channel Guide category
tuned the Guide's other channel, not the provider folder's next one.
Not exercised: holding CH+/CH- to jump to the ends (adb cannot hold the
key long enough).
ahXN00 added a commit to ahXN00/OwnTV_Mobile that referenced this pull request Nov 18, 2026
…ort on Favorites/History, GPL-3.0 licence

Player screen lock: a lock button in the player's top bar. Locked, the
gesture layer is replaced by a plain tap detector that only shows a
"Hold to unlock" pill (3 s, re-armed by every tap); the controls stay
hidden, any open sheet, Sources and Other channels close, and Back only
shows the pill. A long press on the pill unlocks and brings the controls
back. The state is kept for this viewing only (rememberSaveable, so it
survives a rotation). Volume keys and the next-episode card still work.
Strings come from core.

Settings text boxes: SettingsPage and AddSourceForm no longer shrink with
imePadding(); the keyboard's height is added to the list's bottom
contentPadding instead. Shrinking the viewport disposed the bottom rows,
and with them StageTextRow's editing state and its sheet, so TMDB's
"Look up a movie title" closed as soon as the keyboard appeared.

Favorites and History: the Live TV and Library sort tools read a greyed
"Newest first" there and cannot be pressed (StageTool enabled flag),
because core orders those lists by moved items, then newest first. The
stored sort still applies to every other list. Favorites and History sort
rule, rebuilt from ahXN00/OwnTV_Core#85 / ahXN00/OwnTV#369.

LICENSE: the GPL-3.0 text, identical to the TV app's and core's, and a
pointer from the README. Closes #78

Docs: CHANGELOG, USER_GUIDE (screen lock, fixed sort), PARITY_CHECKLIST.

Verified: assembleStandardRelease and lintStandardDebug (0 errors), i18n
literal and overflow checks. On the phone (release build over the
existing install, data kept): History shows a dim "Newest first" that a
tap does not change; the lock blocks taps, swipes and Back, and holding
the pill unlocks; "Look up a movie title" stays open and takes typing
with the keyboard up, in portrait and landscape.
@ahXN00

ahXN00 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

@Quad-Plex thanks, I took the case-insensitive A–Z idea and rebuilt it in core, so sorting now ignores upper/lower case in every alphabet, including Cyrillic. I didn't add A–Z to Favorites and History: those lists stay "newest first" on purpose, you can see there were some earlier PR , i also rejected those , fav and his will not follow sorting, its always last comes first. You're credited in the changelog.

@ahXN00 ahXN00 closed this Nov 20, 2026
ahXN00 added a commit that referenced this pull request Nov 20, 2026
…m a folder, migration screen

Database v56, backup v28.

Search and A-Z in every alphabet
- channels, movies and series gain nameKey, the Unicode lowercase of the name (nameKeyOf),
  recomputed by every copy(name = ...); not part of the content hash.
- MIGRATION_55_56: column, backfill (ASCII names in one SQL lower(), the rest in Kotlin batches),
  A-Z indexes moved to nameKey, channel/movie/series FTS rebuilt on unicode61. No nested transaction.
- every search DAO and A-Z order (incl. the manual-order and custom-category pagers) uses nameKey;
  callers lower the query once. Favorites and History keep their newest-first order.
- guide title search: a non-ASCII query is matched case-folded in Kotlin over the time window, so
  the guide keeps no extra column.
- Xtream: items a per-category request returns without a category go into that category.
- case-insensitive A-Z rebuilt from community PR #85 by @Quad-Plex (not merged: A-Z for Favorites
  and History was not taken, and LOWER(name) folds A-Z only).

Per-profile zoom, text size, popup text size and recent searches
- "<shared key>_<profileId>"; sizes fall back to the shared value, recent searches do not (no
  viewer's searches shown in another profile). The setup wizard writes the shared key.
- backup v28 block "profileDisplay", remapped and clamped on import; forgotten on profile delete.

Subtitles from a folder
- SubtitleFolderMatch (ranking, exact match, search filter), LocalSubtitleFolder (path walk or
  document-tree children query, cached), SubtitleRepository.importLocal reuses a copy only when the
  same name has identical content.
- SubtitleController: folderSubtitles, applyFromFolder, and auto-load when an item has no subtitle of
  its own and exactly one file matches exactly. Settings subtitle_folder / subtitle_folder_auto_load
  (device only, not backed up). 7 strings, every packaged locale.
- SubtitleCharset takes valid UTF-8 first: a UTF-8 file with a few "·" was read as GB18030 ("路").

Database migration
- DatabaseUpgrade wraps every migration; both apps show "Performing database migration" while one
  runs longer than a second. 4 strings, every packaged locale, _mobile sibling for the last line.
- RecordingBootReceiver holds MY_PACKAGE_REPLACED at most 5 s: it opened the database first and
  waited out the migration until Android killed the app mid-migration (rollback, then again).

Verified: core + player-core unit tests (NameKeyTest, ProfileDisplaySettingsTest,
SubtitleFolderMatchTest, SubtitleCharsetTest, migration tests 55->56 and 54->56 compiled),
./gradlew build incl. lint, i18n gates, Weblate format, test_i18n_tools, literal ratchet.
TCL G10 with 69k channels / 254k movies / 73k series: v55->56 and v54->56 upgrade 65-74 s, no ANR,
migration screen shown and kept awake; search after migration; Find in folder on USB, auto-load on
mpv and ExoPlayer, two exact files load nothing. Phone (OnePlus) real v55->56 upgrade: 14 s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants